<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
namespace Agp\CoreBundle\Manager;

use Doctrine\ORM\EntityManager;
use Agp\CoreBundle\Entity\Atendente;
use Agp\CoreBundle\Manager\BaseManager;
/**use Agp\CoreBundle\Manager\BaseManager;
 * Description of AtendenteManager
 *
 * @author bondcs
 */
class AtendenteManager extends BaseManager
{
    public function persist($entity)
    {
        $empresaInc = $this->repository->getLastInc($entity->getEmpresa())+1;
        $entity->setEmpresaInc($empresaInc);
        parent::persist($entity);
    }
    
    public function changeSituacao($entity){
        
        if ($entity->isAtivo()){
            $entity->setSituacao(Atendente::SIT_INATIVO);
        }else{
            $entity->setSituacao(Atendente::SIT_ATIVO);
        }
        
        $this->update($entity);
        
    }

}

?>
